package com.yazi.mxz.mobile.jackson.filter;

import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.yazi.mxz.common.entity.beans.Address;
import com.yazi.mxz.common.entity.beans.Region;

public abstract class AddressFilter {

	public static FilterProvider get() {
		final Set<String> address = new HashSet<String>();
		address.add("addressId");
		address.add("alias");
		address.add("postalCode");
		address.add("street");
		address.add("regionName");
		address.add("consignee");
		address.add("mobile");
		address.add("tel");

		return new SimpleFilterProvider().addFilter(Address.class.getSimpleName(),
				SimpleBeanPropertyFilter.filterOutAllExcept(address));
	}

	public static FilterProvider get4Edit() {
		final Set<String> address = new HashSet<String>();
		address.add("addressId");
		address.add("region");
		address.add("alias");
		address.add("postalCode");
		address.add("street");
		address.add("regionName");
		address.add("consignee");
		address.add("mobile");
		address.add("tel");

		final Set<String> region = new HashSet<String>();
		region.add("regionId");

		return new SimpleFilterProvider().addFilter(Address.class.getSimpleName(),
				SimpleBeanPropertyFilter.filterOutAllExcept(address)).addFilter(
				Region.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept(region));
	}

}
